package com.luckynote.common.base.result;

import com.luckynote.common.base.util.BeanUtil;

import java.util.List;

/**
 * <pre>
 * *********************************************
 * Copyright LUCKY-NOTE.
 * All rights reserved.
 * ****************************************************
 *  Version       Date         Author            Desc
 *    v1.0       2019/6/29      bingo
 * ****************************************************
 * </pre>
 */
public class MultiEntryResult <T> extends SingleEntryResult<MultiEntryContent<T>> {

    private static final long serialVersionUID = 3634188152980313565L;

    public MultiEntryResult() {
        super();
        super.setResult(new MultiEntryContent<>());
    }
    public MultiEntryResult (MultiEntryContent<T> multiContent) {
        super();
        super.setResult(multiContent);
    }
    /**
     * @return the list 集合信息
     */
    public List<T> list() {
        return super.getResult().getList();
    }
    /**
     * @param list the 集合信息 to set
     */
    public void setList(List<T> list) {
        super.getResult().setList(list);
    }
    /**
     * @return the count 符合该查询条件的数据总量，未设置为-1
     */
    public Integer count() {
        return super.getResult().getCount();
    }
    /**
     * @param count the 符合该查询条件的数据总，未设置为-1 to set
     */
    public void setCount(Integer count) {
        super.getResult().setCount(count);
    }
    /**
     * @return the pageNO 页码，此批数据属于第几页，未设置为-1
     */
    public Integer pageNO() {
        return super.getResult().getPageNO();
    }
    /**
     * @param pageNO the 页码，未设置为-1 to set
     */
    public void setPageNO(Integer pageNO) {
        super.getResult().setPageNO(pageNO);
    }
    /**
     * @return the pageSize 每页返回记录数，未设置为-1，全部返回为-2
     */
    public Integer pageSize() {
        return super.getResult().getPageSize();
    }
    /**
     * @param pageSize the 每页返回记录数，未设置为-1，全部返回为-2 to set
     */
    public void setPageSize(Integer pageSize) {
        super.getResult().setPageSize(pageSize);
    }

    public boolean isEmptyResult() {
        return this.list()==null || this.list().size()==0;
    }

    @Override
    public String toJson() {
        return BeanUtil.toJson(this);
    }
}

